﻿<?php 
include("../safe.php"); 
include("../action_save.php");
$actype=$_POST["select"];
$id=intval($_GET["id"]);
$user_name=$_POST["user_name"];
$amount=$_POST["amount"];

if($actype=='cz'){
$sql = "update ph_user set top_up=top_up+".$amount.",balance=balance+".$amount." where ID='".$id."'";
mysql_query($sql,$conn);
insertaction($_SESSION["managername"],"充值金额:".$amount.'用户名:'.$user_name,$conn);
echo "<script language=JavaScript>\r\n";
echo "alert('充值成功!');\r\n";
echo "location.href='list.php'\r\n";
echo "</script>";
}
if($actype=='kf'){
$sql = "update ph_user set balance=balance-".$amount." where ID='".$id."'";
mysql_query($sql,$conn);
insertaction($_SESSION["managername"],"扣减金额:".$amount.'用户名:'.$user_name,$conn);
echo "<script language=JavaScript>\r\n";
echo "alert('充值成功!');\r\n";
echo "location.href='list.php'\r\n";
echo "</script>";
}

?>